import axios from 'axios'
// const querystring = require('querystring')
export function get(url, params) {
    return new Promise((resolve, reject) => {
        axios.get(url, {
            params: params
        }).then(res => {
            resolve(res.data)
        }).catch(err => {
            reject(err.data)
        })
    })
}
export function post(url, params) {
    if (url.indexOf('http') < 0) {
        url = sessionStorage.getItem('ip') + url
    }
    console.log(url,'url');
    return axios.post(url, { params }).then(res => {
        return res
    }).catch(err => {
        console.error(new Error(err), 'err')
        return err
    })

}